]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
network: Merge NMConnectionBased back into NMDevice
authorJasper St. Pierre <jstpierre@mecheye.net>
Fri, 26 Apr 2013 23:28:48 +0000 (19:28 -0400)
committerJasper St. Pierre <jstpierre@mecheye.net>
Fri, 14 Jun 2013 18:15:17 +0000 (14:15 -0400)
https://bugzilla.gnome.org/show_bug.cgi?id=701954

js/ui/status/network.js

index 5ecb2cce8c368a3b91334501320c0496adefa446..dae8a693652754acd55913996b94eaae8fe51167 100644 (file)
@@ -166,13 +166,37 @@ const NMWirelessSectionTitleMenuItem = new Lang.Class({
     }
 });
 
-const NMConnectionBased = new Lang.Class({
-    Name: 'NMConnectionBased',
+const NMDevice = new Lang.Class({
+    Name: 'NMDevice',
     Abstract: true,
 
-    _init: function(connections) {
-        this._connections = [ ];
+    _init: function(client, device, connections) {
+        this._client = client;
+        this._setDevice(device);
+
+        this._connections = [];
         connections.forEach(Lang.bind(this, this.checkConnection));
+
+        this._activeConnection = null;
+        this._activeConnectionItem = null;
+        this._overflowItem = null;
+
+        this.statusItem = new PopupMenu.PopupSwitchMenuItem('', this.connected, { style_class: 'popup-subtitle-menu-item' });
+        this._statusChanged = this.statusItem.connect('toggled', Lang.bind(this, function(item, state) {
+            let ok;
+            if (state)
+                ok = this.activate();
+            else
+                ok = this.deactivate();
+
+            if (!ok)
+                item.setToggleState(!state);
+        }));
+
+        this._updateStatusItem();
+        this.section = new PopupMenu.PopupMenuSection();
+
+        this._deferredWorkId = Main.initializeDeferredWork(this.section.actor, Lang.bind(this, this._createSection));
     },
 
     checkConnection: function(connection) {
@@ -248,40 +272,6 @@ const NMConnectionBased = new Lang.Class({
 
         return two.timestamp - one.timestamp;
     },
-});
-Signals.addSignalMethods(NMConnectionBased.prototype);
-
-const NMDevice = new Lang.Class({
-    Name: 'NMDevice',
-    Abstract: true,
-    Extends: NMConnectionBased,
-
-    _init: function(client, device, connections) {
-        this._client = client;
-        this._setDevice(device);
-        this.parent(connections);
-
-        this._activeConnection = null;
-        this._activeConnectionItem = null;
-        this._overflowItem = null;
-
-        this.statusItem = new PopupMenu.PopupSwitchMenuItem('', this.connected, { style_class: 'popup-subtitle-menu-item' });
-        this._statusChanged = this.statusItem.connect('toggled', Lang.bind(this, function(item, state) {
-            let ok;
-            if (state)
-                ok = this.activate();
-            else
-                ok = this.deactivate();
-
-            if (!ok)
-                item.setToggleState(!state);
-        }));
-
-        this._updateStatusItem();
-        this.section = new PopupMenu.PopupMenuSection();
-
-        this._deferredWorkId = Main.initializeDeferredWork(this.section.actor, Lang.bind(this, this._createSection));
-    },
 
     destroy: function() {
         this._setDevice(null);
@@ -547,6 +537,7 @@ const NMDevice = new Lang.Class({
         this.emit('state-changed');
     }
 });
+Signals.addSignalMethods(NMDevice.prototype);
 
 const NMDeviceSimple = new Lang.Class({
     Name: 'NMDeviceSimple',